import { hashCode } from 'src/utils/string'

const colors = [
  'red-7', 'purple', 'deep-purple', 'indigo', 'blue',
  'cyan', 'teal', 'green', 'light-green',
  'deep-orange', 'brown', 'blue-grey'
]
export function colorOf(s, palette = colors) {
  return palette[hashCode(s) % palette.length] || 'primary'
}

const bgColors = [
  '#f44336', '#e91e63', '#9c27b0', '#673ab7', '#3f51b5', '#2196f3', '#00bcd4', '#009688', '#4caf50', '#795548', '#ff9800', '#ff5722', '#607d8b'
]
export function backgroundColorOf(s, palette = bgColors) {
  return palette[hashCode(s) % palette.length] || '#6A1B9A'
}
